Test improvements and increasing compatibility

Pull request for milestone.