Updated with niklas changes.