fixed bugs with ifndef code, cleaned it up. all tests pass again