Major rewrite of the plotting code

+ Basic 3D plotting funtionality
+ some type annotations