added functions in the code