added loads of print statements for debugging