debugged prototype implementation