Adding validation to all functions that accept input ref #16