Added comments, removed testcode
Added quick-and-dirty iOS support, not tested