Completed image upload, cleaned up code