Intermidiate commit
Stack distances calculates correctly. Restores lambda on time by 3 methods