Written in and out functions