Some code cleanup.

Removed some *duplicate code*.