Broke out validation into separate functions