Several modifications

Some modifications, improvements. Feel free to comment