add secure option
cleanup, bugfixes