simplifying code, not working right now