Avoid using global functions.

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