up to mem stage, rough working, timing need fix