added code from fuin. code is broken. fucked. pls fix soon