Fix problem with octet-stream output. elevation information was returned in wrong order. Also minor refactoring.