Refactor

each commit should be self-explanatory