Combie some changes from idetail.me project