Made as many functions and variables as possible static.