splitting code to functions

errat and package comparison move to different functions, handing of
conditions when errata types are used is moved to another part of the
code - which will be written later.