logic for unitwrap moved to the constructor