Added delete account functionality and refactored code.