Finished cleaning the API

Direct write to DB instead of queued writing