some refactoring, better scaling
phase ending