Wrote a code considering altitude