Made data processing more modular

Only 1 set of code for both website and /json requests