Some cleanups of code.

Signed-off-by: Jacky Boen <aqiank@gmail.com>