terrible graph code : (