New script for element appearance

Almost completely new system of element appearance manipulation with
many bugs fixed.