Added json response for invalid command
Refactored object variable
Restructured some code
Finished changing all response to JSON