working. very messy, but working