Fixed some errors, added legend and timer