Fixed up errors and warnings. Added functions to library.