improve the code and check the GET in index against the list of existing files