added memory stage