Readding in jared's changes / bug fixes