Added code for vectoral direction