Image loading refactoring - making a mess but at passing tests