Yi - fix warning; do some refactoring