Add possibility to upload with sftp and code cleanup.

Code to be tested before production.