refactor and other small changes