Fixes to rsort and calls
Removed final references to models and db