R5.0 restructure code & memory, ERR & BG handling