General code cleanup

- rename variables properly
- delete console.log messages
- format control flow stuff uniformly
- (===) instead of (==)