Refactoring towards a cleaner approach.