Refactoring into cleaner structure