Add validating and unittesting