Throw errors instead of console.error, custom undefined instead of the default one ande some reformatting