added NanExeption class, modified movment system for less code duplications