Added comments to the form building logic
Cleaned up form logic