refactor end of main features