Basic functionality and fuctions for threading without timer