putting brendan's code up