Store direction as a document's property.
+ small fixes