Updated to use scoped_sessions and declarative base