Add getopts to main and break out call_backs.[ch]