Made PUT work and refactored runDB.