first start of the functions so they can be used in multithreading