Fixed the algorithm for getting the alpha