Error checking and first pass at testing