added possibility to set direction