got tiles to arange nicely

code is crap and I borrowed a dash of the algorithm used in
jquery.masonry.js