refactor more code