Made code prettier (removed unnecessary bool variable, split loops)
Introduced ints.