handled mark number of 'x' or 'X' and also fixed bugs