reworked big amounts of code