added refactor logic for lib files