code changes to improve performance