removed inner if