fixed identation & added exception for ValueError