altered layout.js file, added comments and structured it