Properly do #174 and some minor fixes
Fix #172