Reformatted code to stop pycharm complaining