Added text, cleaned up code, added latex equations