move deterministic code to its own package