Added stocktaking instead of a while loop in the main method