Move direction to util and optimize imports