Split image loading functions into separate file