Tidy up resources, move js out of layout and into resource