better comments and clean up doStaircase