simplifying code a big