Fix for #215 and some other related improvements

Okey, makes sense.