Seems to work. Need to clean up a bit.