Refactoring for better organization