improve layout and javascript functionality