Condense code, fix overlapping of graphs