Rewritten using PyQt