removing unused functions and code cleaning