Refactor code into classes
Fix bug with wrong array index for setting username
Cleanup