Upload capabilities added

Changed some of the code to be more organized and also added the
capability to upload data from the client/mobile application.