removed unused code.
added functions.