refactor dash insert and first factorial