fixed pre-reworked version