Port to Python 3 and add some lec stuff