from paulfdoyle repo