Fixes for client file transfer
Cleaned up some code