added functions to code