moved option parsing in library