Added midpoint validations and unit tests