Added some docstrings, better computation for alpha matrix, and residuals method.