Trying to work out performance issues