More work on writing handler