Better way of handling scripts. Still needs improvement.