renamed; tweaked code