Fixes #3064 Removed some dead code, cleaned a few things