A method for cleaning water is disclosed. The method includes adding chitosan into an solution of acetic acid adding thiosemicarbazide into the solution having the added chitosan and stirring the solution having the added chitosan and thiosemicarbazide. The stirred solution is then neutralized with aqueous sodium hydroxide to form precipitates. The precipitates are then filtered and washed a plurality of times with deionized water and ethanol. The washed precipitates are then dried under vacuum to produce a modified chitosan. The modified chitosan is added to the water to remove chemicals from the water.