lot's of additional tweaks to get it to compile