debugged and hopefully final
debugged and hopefully final