Page loader script, more reorg and bug fixing