modified strip function to work with reference point to increase performance