added cpu, mem graph. restructured the functions for better code revision and maintenance.