made changes for bs3 compatability and updated zindex logic