Made changes to the displaying logic and fixed a bug in previous versions