comments and small refactoring
fixed bug with arrays of simpletypes