Except as otherwise stated, the code is copyright 2015 Juris Breidaks, Martins Liberts, Santa Ivanova