Cleanup on all files

Typos, incorrect behaviour/calculcations, use conventions (')