Moving functions to the struct