Cleaning this mess
refactoring