lots of removal and bug fixing