moved validator into separate file