start to tidy the code by reply with json, only done on create and view function. need to check jade file as well.