Cleanup

This fixes some issues with the code, one of which prevents the app from loading in production.