Added painting grids. Added support for different MST weight functions.