Simplifying code in hopes to fix it