Moved construction code to the constructor