made top a function, again