removed more useless code from the original