simplifying the code merging both lines into a single line