utilities implemented using C