refactor some code. start implementing options