Create window algorithim and begin to handle out of bound subscript error