Adding some changes to improve performance