Fixes and features and all that, pull requested!

Yay this.