Several improvements

Here is several improvements I made.
I can't make separate pull request because they're all related.
I'll try to catch you on irc to talk about it (I also have a few questions).