this function needs it's own unittest