Reworked documentation, reformatted the code, changed some code lines

Code changes:
- use of arrays for generating lists
- better id generation in cleanFormElement function