 	timedRefresh()
 ), 500
 
-reflown = []
-launch_state = 0
+core_reflown = []
+cap_reflown = []
 
 new_date = new Date().getTime()
 unix_hour = 60 * 60

	table = document.createElement 'table'
	for p in r
		core_reused = if p.reused then '*' else ''
		capsule_reused = if p.reuse.capsule then '*' else ''
		t_minus = p.launch_date_unix - (new_date / 1000)
		switch
			when (t_minus < 172800) # 2 days
				t_message = (t_minus / unix_hour).toFixed(1) + "h"
			when (t_minus > unix_month)
				t_message = (t_minus / unix_month).toFixed(1) + "m"
			else
				t_message = (t_minus / unix_day).toFixed(1) + "d"
		stream = [
			p.payloads[0].payload_id
			core_reused + p.payloads[0].payload_type
			p.payloads[0].orbit
			p.launch_site.site_name.replace /(?=\D)\s(?=\d)/g, '-'
			p.landing_vehicle || 'expandible'
			"-" + t_message
			('0' + new Date(p.launch_date_utc).getHours()).slice(-2) +
			":" +
			('0' + new Date(p.launch_date_utc).getMinutes()).slice(-2)
			core_reused + p.core_serial
		]
		row = document.createElement 'tr'
		for s in stream
			cell = document.createElement 'td'
			cell.innerHTML = s
			row.appendChild cell
		if p.reused
			cell = document.createElement 'td'
			cell.setAttribute 'id', "#{p.core_serial}"
			cell.setAttribute 'data-launch', "#{p.launch_date_unix}"
			row.appendChild cell
			reflown.push p.core_serial
		table.appendChild row
	document.querySelector('#content').appendChild table
	for ref in reflown
		loadJSON "{{ site.spacex_cores_url }}#{ref}?date=#{new_date}", cb_reflow
	return

cb_reflow = (r) ->
	launch = r[0]
	ele = document.getElementById(launch.core_serial)
	gap = ((ele.getAttribute('data-launch') - launch.launch_date_unix) / unix_month).toFixed(1) + "m"
	ele.innerHTML = "#{gap} #{launch.payloads[0].orbit} #{launch.landing_vehicle}"
	return

# XMLHttpRequest.coffee

			# console.log 'req.status: ', req.status
			# console.log 'req.statusText: ', req.statusText
			if req.status in successResultCodes
				cb(JSON.parse(req.responseText), url)
			else
				document.querySelector('.practices').innerHTML = 'error'
	# console.log 'req: ', req
