Added prototypes and expanded tests