golfed this down a bit since I had time