this seems to be slightly quicker and more reliable