Properly wrap array statements
Add missing docs
Various coding style improvements