<???>
To save on all the declarations and the common blocks i attached the function to existing function/subroutine using CONTAINS at the end of it (do not mix with CONTAINS in modules which works OK). Then i tried to use this function in other places as a callback as usual.
But if i do that i get the run time message that this function is corrupt and program crashes.