Cosmetics

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