cleaned up a bit and added api routes