alternative solutions for 1 and 3 - thanks Sunny