added error numbers and extra functionality