Refactor to load scripts from a php script

fixes #5