Better hooks for local files

Cleaned up for hooks for local files. It can now support both local files and relative URLs.