modified version of rghost