Code cleanup (pointers changed to const references where normal); transitioned to malloc from new for image data arrays