Added many tests and new functionality