Added valid/invalid handlers