comments added
unused functions removed