Second round of fixes from code review