Changed script to return filename