Removed mask array to see if it saves memory