Move JS init to layout