Updated script so it supports single files