Major refactor to remove code duplication
remove useless println