Removing unused code, and refactoring core block