Updating comments and refactored a bit