Add Line graph support
Move general functions into the main script
Add line graph support
fix typo