Added Orientation Support And Error Checking