First working version, needs documentation and argparse very badly