Add test and code review fixes