Refactored code based on pull request comments

Added references