Added documentation, little cleanup
Code refactoring : everything (or almost) has been moved to functions
Functions now return arrays instead of just printing the json data
Update phpdoc and copyright info
BECAUSE WHY NOT
Fix JSON formatting for error output
ERMERGHERD, MERGE SERMPSERN