lots of changes to try to streamline this