Lots of changes, now working