[UPDATE] reworked functions