parameterize, remove unneeded imports, read image efficiently