incorporated validation logic from fp-clj-commons