optimization:load and write changed to save memory