Simplifying code per Jörn's suggestion