Improve speed, misc cleanup & bug fix

Closes #11