Added a trace function to see where the executable is located. Refactored the code to make it more readable