[spram] Refactored Code