Some updates that speeds up revised code

Some updates that speeds up revised code