Do you really not use indentation?

And you still haven't actually specified what your question is or where you're stuck.

If you want help, I suggest you provide an SSCCE along with a specific...