refactoring core

to make local testing with purity more flexible and logically consistent