Basic layout algorithm done.