Lots of fun

* Doc cleanup
* Type casting in foreach
* Fix return_bytes
* Make sure parameters have default values
* Remove unneeded in_array check