Further refactoring of image caption overlay