core: Various cleanups. Fixes indents, strips trailing whitespaces and removes some silly functions