Multiple code improvement.

Signed-off-by: crynobone <crynobone@gmail.com>