Refactored code to let the backend do the calculations. Moved to a modular app