Code ready and commented - final version, only ints, sums and rests