Made some functions const
Change some functions to static