Simplify a bit of code