finished piles.  cleaned up code.