Refactored and still working