Changed error output to mogirfy SQL: more useful
Database changes to work with status decorator
add decorator for study status checks