seperated vary into own class
implemented output caching
updated version