Decent solution with a much simpler directional encoding.