fix #32
fix #31

also fix formatting/naming conventions from #29