added license header and changes based on code review feedback