refactor image loading + add rspec