final working version of perlinCage