bug fix and a lot of new stuff