Update, added loops and some calculations.