Unfinished attempt w/ Kai's client.dart stuff, up to line 259