move and refactor code
finish cleanup