Changed parametrised constructor into a function instead.