added memory data along with code optimized