Added argument parsing and logging

any feedback welcome.