Added more tests and corrected boundary problems