Made it possible to override instance and class methods. Closes #1359