cleaned and enforced some conventions, image matrix shape was incorrect.