compact code a bit