Regarding your first question on the null reference exception, the same answer as always: step through your code in the debugger line by line, look at the variable values, and you will see exactly what is causing the problem. That will help understand how to fix it.