inserted working functions to file