refactor speculation