Added template method design pattern to remove redundant code.
Added auto-run script for automated testing.