#2 tested and fixed