Add sparkline, clean up code