Rest schema change

Changed REST functions to work properly with database schema changes and new procedures.