refactor, fixes