API refactored / samples modified