added a more generic lock