reduce function call overheads
reduce function call overheads
reduce function call overheads
optimise loop for performance