lots of changes to get stuff working better