Minor fix for not declaring all functions globally. Only main needs to be global