optimize imports, remove unneeded casts