logicat refactoring

to make it easier to write ShadwDrgn