Improve: error handling
Fix: naming

Due to duplicate variable name leading to a major conflict in certain
cases.
Improve: check for empty array
Fix: naming

Superglobals shall be written in uppercase