fixing layout and functions