changed constructor usage to function usage