remove some duplicate code and update defaults