Added image loading
Added real log messages
Added more logging
Fixed inverted logic
Added cleanup code