merged some of andrews work into mine