Add users table to migrations; Refactoring and Bugfixing