Code cleanup in Image and Input