Cleaned up code, separate script tag javascript into it's own file