using compact! instead of delete(nil)