Refactor and organize