most functionality written, but failing tests and hangs