refactor options and add a trait so it is reusable