partial fixes from code review
a lot of bs