finished first implementation with the added rules - still a lot to do to remove duplications