Added support for direction parameter