updated code to take care of security issue