code is shorter, thanks scrawl