wow! that was a lot, also fixes #8
Forgot to save this!