Separation of output layer

I've added output layer so it's easy now to implement api for different charts, cli output etc.