Export function simplified
Write function moved to different file
Documentation updated