some slight modifications