Refactor and file organization