Added statistical functions as well as legend capability to plotting
(not completely tested, but works everywhere tested)
Fixed box drawing and arrangment