stat() function functionality implementation