Cleaned up and improved tests