simplify constructor code