reworked most of the code