Clean up and move filesystem stuff into util dir