Refactored javascript and created simple php templates.