Simplified code really much

Simplified the application and code structure very much. Added JSON API
constants