Mostly working, needs to be a lib.