Changed function name for better understandability

Renamed dir to direction