Improved tests as well as the main file.