added automatic path detection for HolyGhost
modularized capturing routines in js