Comments, comments comments!

Other than adding lots of function header comments, also adds an error message print when uploading fails.