unused functions and vars removed.