Simplification and refactoring