add validation functionality, break out into js files