Added user edit capabilities and refactored