This is a rather large method imho. I would suggest breaking it down into more well named methods rather than a single large block of code like it is.