Refactored code and added log in