Logic circuit improved and duplicate code removed from play.jsp