Optimized using lockBits

The program now uses lockBits, allowing for slight improvements in
times. A timer has also been added, allowing for better optimization.