Added code for building training Matrix.  Need more polish