Replaced r with z at phase plane plots
Moved existing common functions to tools.common