Minor changes, improved tests