debugged functionallity