code tidy
move utility function
tidy