refactored code to make name of points layer more generic