fixed tie condition in small screen and added comments/cleaned code on script file