Homeland Security hands out $789M for railways, ports