Squashed all fixes from code review