New base code, written in python this time.