added automatic animation and did some cleaning