Add better error reporting &  cover all cases