Pseusocode implementations of the most important threads