a lot of hacking but much more extended functionality, cleaning is in order