added functions and connected them to index