thanks to Omeid; and a minor correction in code comment