moved testing code so it only excecutes when run as __main__