Improved constructor