Shift logic to ASM