Improved test coverage, bug fixes, and made scopes more consistent