Animation handeling code added