clean up leo's code