Cosmetics

Use C++ casting operator instead of C-style type casting.
Code clean up.