simplifying some code