Added function. Need to add better handling