fixing layout & back end code