modified some logic (and saved the files this time...)