fixed problem with reset
 slight speed improvement by not having to set program state every frame