Testing and cleaning up mains