minor code cleanup
initial work on debugging and making state transfer happer right