Changed ui to use commands instead of the events