trying to make the code more concise