Automated duplicated code detection and procedure extraction