Removed unused code, bugfix