Error checking added, conversion functions, docs changed