debugged a bit