working constructor