Properly wrap main functions