Do some performance improvments