added detection of definitions direction