moved some main methods in a new class + necessary corrections