some code review comments applied