Moved check_if_master to beginning of main