TODO: it seems that the code uses static values a bit too much in functions.