cleaned up errors, and separated out demo page handlers.