originally written by Brint O'Hearn