Nit related to unit testing: it might be useful to create a function that encompasses the logic of whether or not to reject an image because it is "too big" so that the logic can be unit tested. Perhaps something to consider for when the code is ported to master.