added debugging, comments