implements advice from andrew green