Implemented "step forward function". Minor refactoring