Totally refactored