intermediate result of code restructuring

implementing some smart plot functionality