Massive Refactor to reduce smells