major refactoring and using sicp for tests (still some failing)