created detectOPT.m, also made test file. Seems to work, still needs more testing. Has "smart" rotation