filter depending on direction