model bug fixes, more features, and tests