added security and validation