cleaning up
Direction code moved to a separate module
refactoring & mistake fixing (WIP)