Made some extensions and fixed some errors.