Slightly faster functions

Made minor changes so that both functions are slightly faster