refactoring to add functionality for working ahead