Improved workspace directory identification
Removed obsolete code and replaced it with new function calls