Added check for end of missions