removed redundant rec code & added new function