simplifying a small part of code