Everything refactored and working