Multiple fixes and features

Fixes #11, #12, #9, #8