main() cleanup