Simplified function and removed unnecessary files