Added many tests and comments