Add Type Declarations

(and a bit of functionality)