extract function in score controller