Latest changes as per jayrobin's request