Small refactor and filename variable

Performed a small refactor in the main module and have also added a
special variable that can be added to command targets to substitute in
the filename.
Updated with latest changes