Finishes functionallity. TODO: prettify, flot legent, commenting, readability...