some unnecessary print statements removed