Could use `PREFIX` here and eliminate the extra '/' check on line 76.