More "LIMIT 1" removed - and some other SQL improvements.