Fixed type-checking. Added convenience methods.