Changes made for efficiency in code