if you like these changes, maybe you can merge it

Sorry this is my first time on github; I hope I have used the correct function.
I moved something higher up in the code; I used the resolution in the path.