updated comments and renamed methods for better readability