debugged version, stupid me.