Foreach loop repairs & webpage constructor