updated to be more generic