javascript version... might work