added comments and code formatting for test