Improving docs, variable scopes
Improved array safety