helper function now works