Code overhaul using UFPS's event system.

Signed-off-by: michel.topuzoglu <michel.topuzoglu@gmail.com>