First attempt at symlink changes

Mostly based on a patch by Zuhayr Khan, minor changes & additions by me.