cleaned up, wrote code