working code!
make tests better i hope