reviewed gc implementation