added simple validation / refactor