added foreach in direction