Added support for top and bottom directions