Simplify some code a little