refactor to support more options