Cleaner code

i added one extra function that will take care of the json values so i
can easily call it to make it submit and complete.