completed code during MSc