fixed html errors and added visibility conditions