Handle errors Added testing