switched to cout, many fixes