Better testing and logging