replacement of original altitude function with better one