improved the efficiency a little