Added subscribe method that infers types, and updated tests.