Cleaned and refactored code #101