lib: add options, improve style