refactored API constructor and initialization / refactored examples / updated tests