fixed symlink cycling and compacted code