changed structure for showImage by splitting into updateBuffer and showImage
merged conflicting showImage functions
fix'ed showImage in if statement but may have lost functionality in the if statement