implementing an efficient layout