refactor: move direction to library
fix: movement within border underflow of unsigned integer
refactor: move direction functions to separate module