Code cleanup, few tweaks