Slightly refactored MultipartEncoder + improved unit tests

proposed patch contains a lot of print (to be cleaned up)