Move option parsing to library file