added attack and fixed some bugs