added seek function
added handler for potential empty directory condition