refactoring
 major refactoring , extract stepIndexer, add more unit tests