original and optimised combined