Moved scripts to bottom and cleaned code.