Fixed memory leak, removed unneccessary file lookup