fix and enhance and update the code

add threshold option, update the configuration to take ACL permission for amazon