more or less finished in an ugly way, but got it done