Rewrote package, partially implemented subscriptions. Fixes #1.

Code size was also reduced by ~20%.