diff --git a/Skeleton.cpp b/Skeleton.cpp
index 90d6d9f116b202ebe482e7522a0ee1ae4497dcbb..05358686ba3b14644404f22a76764389ba87472b 100644
--- a/Skeleton.cpp
+++ b/Skeleton.cpp
@@ -203,7 +203,7 @@ struct Light {
 	
 	float getDistance(const vec3& point) const {
 	    vec3 d = point - position;
-        return sqrtf(dot(d, d));
+        return length(d);
 	}
 };
 
@@ -288,8 +288,8 @@ public:
 		if (hit.material->type == ROUGH) {
             outRadiance = hit.material->ka * La;
             for (Light *light : lights) {
-                Ray shadowRay(hit.position + hit.normal * epsilon, light->position);
-                float cosTheta = dot(hit.normal, light->position);
+                auto cosTheta = dot(hit.normal, light->getDirection(hit.position));
+                Ray shadowRay(hit.position + hit.normal * epsilon, light->getDirection(hit.position));
                 if (cosTheta > 0 && !shadowIntersect(shadowRay, light)) {    // shadow computation
                     vec3 le = light->Le / powf(light->getDistance(hit.position), 2);
                     outRadiance = outRadiance + le * hit.material->kd * cosTheta;
@@ -438,6 +438,6 @@ void onMouseMotion(int pX, int pY) {
 
 // Idle event indicating that some time elapsed: do animation here
 void onIdle() {
-    scene.Animate(.1f);
+    scene.Animate(.05f);
     glutPostRedisplay();
 }