Code optimized

Memory & Code optimization