moved code to required layout and view areas