Refactored code to v3
Run from single file with ARGV inputs