cleaned up and improved the template point generator