partial implementation of layout