It finally works. Not pretty, but works