drawImage, drawFrame and various cleanup