Added options and a number of minor fixes