Made changes to improve efficiency