hopefully debugged