Mostly working, needs some tweaking.