fix sort
refactoring controller