Refactoring and add option to use absolute path