Implemented grid layout mode.

Need to fix a SEGFAULT when the last client is removed.