Added comments
Properly indented all code
Updated phpDoc