Changed Triple API.
Some code clean up.