added some basic static typing and beging to implement apply-move