added comments for better readability