Some small changes to improve performance