changes interface:
* constructor instead plain object
* renames function