Made the app more modular and fixed some bugs