First version

- reworked prototypes
- added new features, now on-par with the perl module
- reindented code