Fixes #10  and some cleanings #4