Major update, added S4 methods.