Be C89 friendly, declare variables on the top of the functions