Move important setup function to the top of file