added delegate constructor and some other tweaks