AFMotor shield - PWM strangely getting interrupted by sketch code

Although it is confusing that, using the same modified library and a new sketch, motor control works fine. Although it still gets interrupted with delays.

I am thinking the problem is PWM pin 5, since on the arduino website it states delays interrupt pins 5 and 6.
I have decided to plan this project a bit better.

As it turns out, i should be able to use the standard library. That should be a more sensible approach, and would eliminate severe problems.

2 - Temp. sensor
3- D4
4- MOTORCLK
5- D5
6-D6
7-MOTORENABLE
8-MOTORDATA
9-D7
10-RPM
11-MOTOR1 PWM
12-MOTORLATCH
13
14-LCD Keypad
15-LCD RS
16-LCD Enable

https://www.dropbox.com/s/ga51ljsg8l9plfp/AFMotor.cpp