Modified for Duapp.
Code cleaned.