Refactor circuit manager to better support correct algorithms