Uncomplete 2014's solution. May contain erros. To be continued.