Needs to be a better way of doing this