added flash notification and validation