some refactor and update scaladoc