working out pugs in code