Some refactoring. Added user editing and deletion.