Several improvements but it is not tested.