Beginner solution (locks)