write mostly works now!