Updated error handling, data truncation and directory structure