Fixed typo.
Made error strings more descriptive.
Added function framework.