Pull request cleanup

Resolves merge conflicts and pulls in changes from #55, #61 and #61.