Refactored the entire app