reworked code