refactor codes & restructure directories