Added common eror codes and misc clean-up

Change-Id: If199d10b6f787f931234932f5ff13d6f863c3c56