bugfix & code cleaning

I found that WSE was not working on my old android phone. 
The reasons were using "while" keyword and "children" attribute.
Fixed that and unified commands declaration to use out.commands["foo"] instead of out.commands.foo