Various changes

For more information read the code :P