Fix #26, #27, #28, #29, #30, #31, #32. First run at #22