fixed logic error in bounds checking
removed assert()'s
removed extraneous assert()