Barebones code for Image loading added with some error checking