Refactor code, WIP