tweaked method for improved efficiency