Mostly working, needs cleanup and error states