Merge changes from ConnorStone´s version