bug fix
added debug output
bug fix
small changes
cleared cin buffer