got rid of global functions.