Moving functions to renderer