Bunch of stuff, will fix and form it as plugin other time