added argument parsing and file logging