Moved script loading to layout