Simplified loops, implemented ceil and floor limits from Gu2010 in 1D case.