Making functions less hacky