Update based on Alexey's advice