Briefly, without looking at the code have you thought of using a debugger and stepping through your code. This will show you where it is hanging.

Just a thought.