Refactor to tidy up dirty pixel checking.