Kinda working, needs tests and polishing