removes unused code

removes unused code and fixes #610