Unified error handling added error checking for playlist adding.
Added some tests and formated code.