Refactored toservice module.

I've split the Upload method into several parts, which should make it
easier to do the actual upload part asynchronously.