Fixed bugs that were caused by putting file searching in a different method