incorporated changes pointed out by Andrej