Speedup on Q calculation with the use of vectorisation, still more area for imporovement
Removed unrequired function through vectorisation and moving up to call