added part of the orientation detection and some transformation comments at the end of the file