cleaned up nested conditional syntax