added orientation detection and classes