Added clone implementation; adjust code to use it