More resource friendly implementation