simplified code, remove now unsued function