improved constructor