Updated functions

I think it will be slightly more efficient