cleanup and refactor small changes