it'd be nicer to have separate functions for this parsing json logic if possible... this function is huge and it won't make a big difference, but it'd be a start :) ...