added function to get the absolute path and automatic file loading