Reduce server calls to make script faster