Move out of main and into constructor