Worked a tiny bit on cleaning up code