updated with fix to poor performance of BAOS write