changed getcwd to function and related "USE IFPORT"