split code into class, add default filename