Fork from robbyrussell and added some self settings