remove unnecessary prints
bugfix + cleaning the code

removing code duplication and unnecessary prints