implemented a bunch of minor fixes