added logic for tracking player lives