Implementation of the rest. Works with flaws.