simplify the code a little bit