Cleanup & refactor