Replaced awk with the paste command for condition extraction
Minor modifications