Move symlink check in separate function