Can merge this function into constructor?