made changes to support child postloop widgets

- moved a variables to be class variables
- set visibility on all functions
- fixed a small bug @ line 256
- removed an unused line @ line 588
- broke the `form` function into many individual functions