Refactored some code and made profile pictures actually save. Fixes #6