Updated the way of calculateing average mapping quality etc.