Refactored cleaned and working