Functions were used before being defined

Signed-off-by: Marc Delisle <marc@infomarc.info>