Use HOF to apply locks