made some modifications to the original