Simplifications and removal of unused code