Reworked that nasty procedure Apply function