reorganize folders & refactor code